import Vue from 'vue'
import Router from 'vue-router'

import homeRouters from '@/router/home/home'
import loginAndRegistryRouters from '@/router/loginAndRegistry/loginAndRegistry'
import personalCentre from '@/router/personalCentre/personalCentre'
import videoRouters from '@/router/video/chaosVideo'
import tougaoRouters from '@/router/tougao/chaosTougao'
import fanjuRouters from '@/router/fanju/fanju'

Vue.use(Router)


const baseRoutes = [];
//合并两个路由
const routes = baseRoutes.concat(homeRouters, loginAndRegistryRouters, personalCentre,videoRouters,tougaoRouters,fanjuRouters);

/**
 * 解决同路由跳转报错的vue的bug!
 * @type {{(location: RawLocation): Promise<Route>; (location: RawLocation, onComplete?: Function, onAbort?: ErrorHandler): void}}
 */
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

export default new Router({
  mode:'history',
  routes
})

